package model.semantics;

import java.util.List;

import model.State;

public class AggregatorNode<T> extends Node<T> {
	List<Node<T>> myChildren;
	
	public AggregatorNode(List<Node<T>> values) {
		myChildren = values;
	}

	@Override
	public T evaluate(State<T> state) {
		T output = null;
		for(Node<T> child : myChildren) {
			output = child.evaluate(state);
		}
		
		return output;
	}
	
	@Override
	public String toString() {
		return String.format("(agg %s)", myChildren.toString());
	}
}
